function trim(a) {
    var b;
    if (a) {
        for (;" " == a.substring(0, 1); ) a = a.substring(1, a.length);
        for (;" " == a.substring(a.length - 1, a.length); ) a = a.substring(0, a.length - 1);
        b = a;
    } else b = "";
    return b;
}

!function($) {
    $.fn.imgZoomRender = function() {
        var b = 200, c = 200, d = "standard", e = "fadeout", f = "slow";
        null != $(this).attr("zoomWidth") && (b = parseInt($(this).attr("zoomWidth"))), 
        null != $(this).attr("zoomHeight") && (c = parseInt($(this).attr("zoomHeight"))), 
        null != $(this).attr("zoomType") && (d = $(this).attr("zoomType")), $(this).jqzoom({
            zoomWidth: b,
            zoomHeight: c,
            zoomType: d,
            hideEffect: e,
            fadeoutSpeed: f
        });
    }, $.fn.jqzoom = function(options) {
        var settings = {
            zoomType: "standard",
            zoomWidth: 200,
            zoomHeight: 200,
            xOffset: 10,
            yOffset: 0,
            position: "right",
            lens: !0,
            lensReset: !1,
            imageOpacity: .2,
            title: !1,
            alwaysOn: !1,
            showEffect: "show",
            hideEffect: "hide",
            fadeinSpeed: "fast",
            fadeoutSpeed: "slow",
            preloadImages: !0,
            showPreload: !0,
            preloadText: "Loading zoom",
            preloadPosition: "center"
        };
        return options = options || {}, $.extend(settings, options), this.each(function() {
            function activate() {
                return running ? void 0 : (smallimage.findborder(), running = !0, imageTitle = img.attr("title"), 
                img.removeAttr("title"), aTitle = a.attr("title"), $(a).removeAttr("title"), (!largeimage || $.browser.safari) && (largeimage = new Largeimage(a[0].href)), 
                !largeimageloaded || $.browser.safari ? largeimage.loadimage() : ("innerzoom" != settings.zoomType && (stage = new Stage(), 
                stage.activate()), lens = new Lens(), lens.activate()), a[0].blur(), !1);
            }
            function deactivate() {
                if ("reverse" != settings.zoomType || settings.alwaysOn || img.css({
                    opacity: 1
                }), settings.alwaysOn) {
                    if (settings.lensReset) switch (settings.zoomType) {
                      case "innerzoom":
                        largeimage.setcenter();
                        break;

                      default:
                        lens.center();
                    }
                } else running = !1, largeimageloaded = !1, $(lens.node).unbind("mousemove"), lens.remove(), 
                $("div.jqZoomWindow").length > 0 && stage.remove(), $("div.jqZoomTitle").length > 0 && ZoomTitleObj.remove(), 
                img.attr("title", imageTitle), a.attr("title", aTitle), $().unbind(), a.unbind("mousemove"), 
                firstime = 0, jQuery(".zoom_ieframe").length > 0 && jQuery(".zoom_ieframe").remove();
                settings.alwaysOn && activate();
            }
            function Smallimage(image) {
                return this.node = image[0], this.loadimage = function() {
                    this.node.src = image[0].src;
                }, this.findborder = function() {
                    var borderleft, x, bordertop = "";
                    if (bordertop = $(img).css("border-top-width"), btop = "", borderleft = "", borderleft = $(img).css("border-left-width"), 
                    bleft = "", bordertop) for (i = 0; 3 > i && (x = [], x = bordertop.substr(i, 1), 
                    0 == isNaN(x)); i++) btop = btop + "" + bordertop.substr(i, 1);
                    if (borderleft) for (i = 0; 3 > i && !isNaN(borderleft.substr(i, 1)); i++) bleft += borderleft.substr(i, 1);
                    btop = btop.length > 0 ? eval(btop) : 0, bleft = bleft.length > 0 ? eval(bleft) : 0;
                }, this.node.onload = function() {
                    a.css({
                        cursor: "crosshair",
                        display: "block"
                    }), "absolute" != a.css("position") && a.parent().css("position") && a.css({
                        cursor: "crosshair",
                        position: "relative",
                        display: "block"
                    }), "absolute" != a.parent().css("position") && a.parent().css("position", "relative"), 
                    ($.browser.safari || $.browser.opera) && $(img).css({
                        position: "absolute",
                        top: "0px",
                        left: "0px"
                    }), smallimagedata.w = $(this).width(), smallimagedata.h = $(this).height(), smallimagedata.h = $(this).height(), 
                    smallimagedata.pos = $(this).offset(), smallimagedata.pos.l = $(this).offset().left, 
                    smallimagedata.pos.t = $(this).offset().top, smallimagedata.pos.r = smallimagedata.w + smallimagedata.pos.l, 
                    smallimagedata.pos.b = smallimagedata.h + smallimagedata.pos.t, a.height(smallimagedata.h), 
                    a.width(smallimagedata.w), settings.preloadImages && largeimage.loadimage();
                }, this;
            }
            function Lens() {
                return this.node = document.createElement("div"), $(this.node).addClass("jqZoomPup"), 
                this.node.onerror = function() {
                    $(lens.node).remove(), lens = new Lens(), lens.activate();
                }, this.loadlens = function() {
                    switch (settings.zoomType) {
                      case "reverse":
                        this.image = new Image(), this.image.src = smallimage.node.src, this.node.appendChild(this.image), 
                        $(this.node).css({
                            opacity: 1
                        });
                        break;

                      case "innerzoom":
                        this.image = new Image(), this.image.src = largeimage.node.src, this.node.appendChild(this.image), 
                        $(this.node).css({
                            opacity: 1
                        });
                    }
                    switch (settings.zoomType) {
                      case "innerzoom":
                        lensdata.w = smallimagedata.w, lensdata.h = smallimagedata.h;
                        break;

                      default:
                        lensdata.w = settings.zoomWidth / scale.x, lensdata.h = settings.zoomHeight / scale.y;
                    }
                    $(this.node).css({
                        width: lensdata.w + "px",
                        height: lensdata.h + "px",
                        position: "absolute",
                        display: "none",
                        borderWidth: "1px"
                    }), a.append(this.node);
                }, this;
            }
            function Largeimage(a) {
                return this.url = a, this.node = new Image(), this.loadimage = function() {
                    this.node || (this.node = new Image()), this.node.style.position = "absolute", this.node.style.display = "none", 
                    this.node.style.left = "-5000px", this.node.style.top = "10px", loader = new Loader(), 
                    settings.showPreload && !preloadshow && (loader.show(), preloadshow = !0), document.body.appendChild(this.node), 
                    this.node.src = this.url;
                }, this.node.onload = function() {
                    var a, b;
                    this.style.display = "block", a = Math.round($(this).width()), b = Math.round($(this).height()), 
                    this.style.display = "none", scale.x = a / smallimagedata.w, scale.y = b / smallimagedata.h, 
                    $("div.preload").length > 0 && $("div.preload").remove(), largeimageloaded = !0, 
                    "innerzoom" != settings.zoomType && running && (stage = new Stage(), stage.activate()), 
                    running && (lens = new Lens(), lens.activate()), $("div.preload").length > 0 && $("div.preload").remove();
                }, this;
            }
            function Stage() {
                var a = smallimagedata.pos.l, b = smallimagedata.pos.t;
                switch (this.node = document.createElement("div"), $(this.node).addClass("jqZoomWindow"), 
                $(this.node).css({
                    position: "absolute",
                    width: Math.round(settings.zoomWidth) + "px",
                    height: Math.round(settings.zoomHeight) + "px",
                    display: "none",
                    zIndex: 1e4,
                    overflow: "hidden"
                }), settings.position) {
                  case "right":
                    a = smallimagedata.pos.r + Math.abs(settings.xOffset) + settings.zoomWidth < screen.width ? smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset) : smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset), 
                    topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight, b = topwindow < screen.height && topwindow > 0 ? smallimagedata.pos.t + settings.yOffset : smallimagedata.pos.t;
                    break;

                  case "left":
                    a = smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth > 0 ? smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth : smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset), 
                    topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight, b = topwindow < screen.height && topwindow > 0 ? smallimagedata.pos.t + settings.yOffset : smallimagedata.pos.t;
                    break;

                  case "top":
                    b = smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight > 0 ? smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight : smallimagedata.pos.t + smallimagedata.h + Math.abs(settings.yOffset), 
                    leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth, a = leftwindow < screen.width && leftwindow > 0 ? smallimagedata.pos.l + settings.xOffset : smallimagedata.pos.l;
                    break;

                  case "bottom":
                    b = smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < $("body").height() ? smallimagedata.pos.b + Math.abs(settings.yOffset) : smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset), 
                    leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth, a = leftwindow < screen.width && leftwindow > 0 ? smallimagedata.pos.l + settings.xOffset : smallimagedata.pos.l;
                    break;

                  default:
                    a = smallimagedata.pos.l + smallimagedata.w + settings.xOffset + settings.zoomWidth < screen.width ? smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset) : smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset), 
                    b = smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < screen.height ? smallimagedata.pos.b + Math.abs(settings.yOffset) : smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset);
                }
                return this.node.style.left = a + "px", this.node.style.top = b + "px", this;
            }
            function zoomTitle() {
                this.node = jQuery("<div />").addClass("jqZoomTitle").html("" + ZoomTitle), this.loadtitle = function() {
                    "innerzoom" == settings.zoomType ? $(this.node).css({
                        position: "absolute",
                        top: smallimagedata.pos.b + 3,
                        left: smallimagedata.pos.l + 1,
                        width: smallimagedata.w
                    }).appendTo("body") : $(this.node).appendTo(stage.node);
                };
            }
            function Loader() {
                return this.node = document.createElement("div"), $(this.node).addClass("preload"), 
                $(this.node).html(settings.preloadText), $(this.node).appendTo("body").css("visibility", "hidden"), 
                this.show = function() {
                    switch (settings.preloadPosition) {
                      case "center":
                        loadertop = smallimagedata.pos.t + (smallimagedata.h - $(this.node).height()) / 2, 
                        loaderleft = smallimagedata.pos.l + (smallimagedata.w - $(this.node).width()) / 2;
                        break;

                      default:
                        var a = this.getoffset();
                        loadertop = isNaN(a.top) ? smallimagedata.pos.t + 0 : smallimagedata.pos.t + a.top, 
                        loaderleft = isNaN(a.left) ? smallimagedata.pos.l + 0 : smallimagedata.pos.l + a.left;
                    }
                    $(this.node).css({
                        top: loadertop,
                        left: loaderleft,
                        position: "absolute",
                        visibility: "visible"
                    });
                }, this;
            }
            var img, imageTitle, smallimage, smallimagedata, btop, bleft, loader, ZoomTitle, ZoomTitleObj, largeimage, lens, lensdata, largeimageloaded, scale, stage, running, mousepos, firstime, preloadshow, isMouseDown, dragstatus, a = $(this), aTitle = a.attr("title");
            $(a).removeAttr("title"), $(a).css("outline-style", "none"), img = $("img", this), 
            imageTitle = img.attr("title"), img.removeAttr("title"), smallimage = new Smallimage(img), 
            smallimagedata = {}, btop = 0, bleft = 0, loader = null, loader = new Loader(), 
            ZoomTitle = trim(aTitle).length > 0 ? aTitle : trim(imageTitle).length > 0 ? imageTitle : null, 
            ZoomTitleObj = new zoomTitle(), largeimage = new Largeimage(a[0].href), lens = new Lens(), 
            lensdata = {}, largeimageloaded = !1, scale = {}, stage = null, running = !1, mousepos = {}, 
            firstime = 0, preloadshow = !1, isMouseDown = !1, dragstatus = !1, smallimage.loadimage(), 
            $(this).click(function() {
                return !1;
            }), $(this).hover(function(a) {
                mousepos.x = a.pageX, mousepos.y = a.pageY, activate();
            }, function() {
                deactivate();
            }), settings.alwaysOn && setTimeout(function() {
                activate();
            }, 150), Lens.prototype.activate = function() {
                switch (this.loadlens(), settings.zoomType) {
                  case "reverse":
                    img.css({
                        opacity: settings.imageOpacity
                    }), settings.alwaysOn ? lens.center() : lens.setposition(null), a.bind("mousemove", function(a) {
                        mousepos.x = a.pageX, mousepos.y = a.pageY, lens.setposition(a);
                    });
                    break;

                  case "innerzoom":
                    $(this.node).css({
                        top: 0,
                        left: 0
                    }), settings.title && ZoomTitleObj.loadtitle(), largeimage.setcenter(), a.bind("mousemove", function(a) {
                        mousepos.x = a.pageX, mousepos.y = a.pageY, largeimage.setinner(a);
                    });
                    break;

                  default:
                    settings.alwaysOn ? lens.center() : lens.setposition(null), $(a).bind("mousemove", function(a) {
                        mousepos.x = a.pageX, mousepos.y = a.pageY, lens.setposition(a);
                    });
                }
                return this;
            }, Lens.prototype.setposition = function(b) {
                function e() {
                    return mousepos.x - (lensdata.w + 2) / 2 - bleft < smallimagedata.pos.l;
                }
                function f() {
                    return mousepos.x + (lensdata.w + 2) / 2 > smallimagedata.pos.r + bleft;
                }
                function g() {
                    return mousepos.y - (lensdata.h + 2) / 2 - btop < smallimagedata.pos.t;
                }
                function h() {
                    return mousepos.y + (lensdata.h + 2) / 2 > smallimagedata.pos.b + btop;
                }
                var c, d;
                return b && (mousepos.x = b.pageX, mousepos.y = b.pageY), 0 == firstime ? (c = smallimagedata.w / 2 - lensdata.w / 2, 
                d = smallimagedata.h / 2 - lensdata.h / 2, $("div.jqZoomPup").show(), settings.lens ? this.node.style.visibility = "visible" : (this.node.style.visibility = "hidden", 
                $("div.jqZoomPup").hide()), firstime = 1) : (c = mousepos.x - smallimagedata.pos.l - lensdata.w / 2, 
                d = mousepos.y - smallimagedata.pos.t - lensdata.h / 2), e() ? c = 0 + bleft : f() && (c = $.browser.msie ? smallimagedata.w - lensdata.w + bleft + 1 : smallimagedata.w - lensdata.w + bleft - 1), 
                g() ? d = 0 + btop : h() && (d = $.browser.msie ? smallimagedata.h - lensdata.h + btop + 1 : smallimagedata.h - lensdata.h - 1 + btop), 
                c = parseInt(c), d = parseInt(d), $("div.jqZoomPup", a).css({
                    top: d,
                    left: c
                }), "reverse" == settings.zoomType && $("div.jqZoomPup img", a).css({
                    position: "absolute",
                    top: -(d - btop + 1),
                    left: -(c - bleft + 1)
                }), this.node.style.left = c + "px", this.node.style.top = d + "px", largeimage.setposition(), 
                this;
            }, Lens.prototype.center = function() {
                var b, c;
                $("div.jqZoomPup", a).css("display", "none"), b = smallimagedata.w / 2 - lensdata.w / 2, 
                c = smallimagedata.h / 2 - lensdata.h / 2, this.node.style.left = b + "px", this.node.style.top = c + "px", 
                $("div.jqZoomPup", a).css({
                    top: c,
                    left: b
                }), "reverse" == settings.zoomType && $("div.jqZoomPup img", a).css({
                    position: "absolute",
                    top: -(c - btop + 1),
                    left: -(b - bleft + 1)
                }), largeimage.setposition(), $.browser.msie ? $("div.jqZoomPup", a).show() : setTimeout(function() {
                    $("div.jqZoomPup").fadeIn("fast");
                }, 10);
            }, Lens.prototype.getoffset = function() {
                var a = {};
                return a.left = parseInt(this.node.style.left), a.top = parseInt(this.node.style.top), 
                a;
            }, Lens.prototype.remove = function() {
                "innerzoom" == settings.zoomType ? $("div.jqZoomPup", a).fadeOut("fast", function() {
                    $(this).remove();
                }) : $("div.jqZoomPup", a).remove();
            }, Lens.prototype.findborder = function() {
                var borderleft, temp, x, bordertop = "";
                if (bordertop = $("div.jqZoomPup").css("borderTop"), lensbtop = "", borderleft = "", 
                borderleft = $("div.jqZoomPup").css("borderLeft"), lensbleft = "", $.browser.msie && (temp = bordertop.split(" "), 
                bordertop = temp[1], temp = borderleft.split(" "), borderleft = temp[1]), bordertop) for (i = 0; 3 > i && (x = [], 
                x = bordertop.substr(i, 1), 0 == isNaN(x)); i++) lensbtop = lensbtop + "" + bordertop.substr(i, 1);
                if (borderleft) for (i = 0; 3 > i && !isNaN(borderleft.substr(i, 1)); i++) lensbleft += borderleft.substr(i, 1);
                lensbtop = lensbtop.length > 0 ? eval(lensbtop) : 0, lensbleft = lensbleft.length > 0 ? eval(lensbleft) : 0;
            }, Largeimage.prototype.setposition = function() {
                this.node.style.left = Math.ceil(-scale.x * parseInt(lens.getoffset().left) + bleft) + "px", 
                this.node.style.top = Math.ceil(-scale.y * parseInt(lens.getoffset().top) + btop) + "px";
            }, Largeimage.prototype.setinner = function(b) {
                this.node.style.left = Math.ceil(-scale.x * Math.abs(b.pageX - smallimagedata.pos.l)) + "px", 
                this.node.style.top = Math.ceil(-scale.y * Math.abs(b.pageY - smallimagedata.pos.t)) + "px", 
                $("div.jqZoomPup img", a).css({
                    position: "absolute",
                    top: this.node.style.top,
                    left: this.node.style.left
                });
            }, Largeimage.prototype.setcenter = function() {
                this.node.style.left = Math.ceil(-scale.x * Math.abs(smallimagedata.w / 2)) + "px", 
                this.node.style.top = Math.ceil(-scale.y * Math.abs(smallimagedata.h / 2)) + "px", 
                $("div.jqZoomPup img", a).css({
                    position: "absolute",
                    top: this.node.style.top,
                    left: this.node.style.left
                });
            }, Stage.prototype.activate = function() {
                switch (this.node.firstChild || this.node.appendChild(largeimage.node), settings.title && ZoomTitleObj.loadtitle(), 
                document.body.appendChild(this.node), settings.showEffect) {
                  case "show":
                    $(this.node).show();
                    break;

                  case "fadein":
                    $(this.node).fadeIn(settings.fadeinSpeed);
                    break;

                  default:
                    $(this.node).show();
                }
                $(this.node).show(), $.browser.msie && $.browser.version < 7 && (this.ieframe = $('<iframe class="zoom_ieframe" frameborder="0" src="#"></iframe>').css({
                    position: "absolute",
                    left: this.node.style.left,
                    top: this.node.style.top,
                    zIndex: 99,
                    width: settings.zoomWidth,
                    height: settings.zoomHeight
                }).insertBefore(this.node)), largeimage.node.style.display = "block";
            }, Stage.prototype.remove = function() {
                switch (settings.hideEffect) {
                  case "hide":
                    $(".jqZoomWindow").remove();
                    break;

                  case "fadeout":
                    $(".jqZoomWindow").fadeOut(settings.fadeoutSpeed);
                    break;

                  default:
                    $(".jqZoomWindow").remove();
                }
            }, zoomTitle.prototype.remove = function() {
                $(".jqZoomTitle").remove();
            }, Loader.prototype.getoffset = function() {
                var a = null;
                return a = $("div.preload").offset();
            };
        });
    };
}(jQuery), $(function() {
    $(".zoomView").each(function() {});
});